<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>

description("This tests the constructor for the WebGLContextEvent DOM class.");

// No initializer is passed.
shouldBe("new WebGLContextEvent('eventType').bubbles", "false");
shouldBe("new WebGLContextEvent('eventType').cancelable", "false");
shouldBeEqualToString("new WebGLContextEvent('eventType').statusMessage", "");

// bubbles is passed.
shouldBe("new WebGLContextEvent('eventType', { bubbles: false }).bubbles", "false");
shouldBe("new WebGLContextEvent('eventType', { bubbles: true }).bubbles", "true");

// cancelable is passed.
shouldBe("new WebGLContextEvent('eventType', { cancelable: false }).cancelable", "false");
shouldBe("new WebGLContextEvent('eventType', { cancelable: true }).cancelable", "true");

// statusMessage is passed.
// Strings.
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: 'abcde' }).statusMessage", "abcde");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: '' }).statusMessage", "");

// Non-strings.
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: undefined }).statusMessage", "");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: null }).statusMessage", "null");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: false }).statusMessage", "false");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: true }).statusMessage", "true");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: 12345 }).statusMessage", "12345");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: 18446744073709551615 }).statusMessage", "18446744073709552000");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: NaN }).statusMessage", "NaN");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: [] }).statusMessage", "");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: [1, 2, 3] }).statusMessage", "1,2,3");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: {abcde: 12345} }).statusMessage", "[object Object]");
shouldBeEqualToString("new WebGLContextEvent('eventType', { statusMessage: {valueOf: function () { return 'abcde'; } } }).statusMessage", "[object Object]");

// All initializers are passed.
shouldBe("new WebGLContextEvent('eventType', { bubbles: true, cancelable: true, statusMessage: 'abcde' }).bubbles", "true");
shouldBe("new WebGLContextEvent('eventType', { bubbles: true, cancelable: true, statusMessage: 'abcde' }).cancelable", "true");
shouldBe("new WebGLContextEvent('eventType', { bubbles: true, cancelable: true, statusMessage: 'abcde' }).statusMessage", "'abcde'");
</script>
</body>
</html>
